<?php
	$yhendus=new mysqli("localhost", "if13", "ifikad", "if13_Martin");
	$kask=$yhendus->prepare("SELECT ISIK_ID, ENIMI, PNIMI, EMAIL from ISIK order by ISIK_ID;");
    $kask->bind_result($id, $eesnimi,$perenimi,$email);
    $kask->execute();
	
	
	echo"<table border='1'><tr><th>ID</th><th>Eesnimi</th><th>Perekonnna nimi</th><th>email</th></tr>";
	while($kask->fetch()){
		echo"<tr><td>$id</td><td>$eesnimi</td><td>$perenimi</td><td>$email</td><td><a href='?kustutasid=$id'>kustuta</a></td></tr>";
	}
?>
	</table>
<?php
	if(isSet($_REQUEST["kustutasid"])){
		$kask=$yhendus->prepare("DELETE FROM ISIK WHERE ISIK_ID=?");
		$kask->bind_param("i",$_REQUEST["kustutasid"]);
		$kask->execute();
		header("Location: $_SERVER[PHP_SELF]");
		}
	$yhendus->close();
?>